#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
检查可用的ODBC驱动程序
"""

import pyodbc

def check_odbc_drivers():
    """检查可用的ODBC驱动程序"""
    print("🔍 检查可用的ODBC驱动程序...")
    print("=" * 50)
    
    try:
        drivers = pyodbc.drivers()
        if drivers:
            print("✅ 找到以下ODBC驱动程序:")
            for i, driver in enumerate(drivers, 1):
                print(f"  {i}. {driver}")
        else:
            print("❌ 没有找到任何ODBC驱动程序")
            
        print("\n🔍 检查SQL Server相关的驱动程序...")
        sql_drivers = [d for d in drivers if 'SQL Server' in d or 'SQL' in d]
        if sql_drivers:
            print("✅ 找到SQL Server相关驱动程序:")
            for driver in sql_drivers:
                print(f"  - {driver}")
        else:
            print("❌ 没有找到SQL Server相关驱动程序")
            
    except Exception as e:
        print(f"❌ 检查驱动程序时出错: {e}")

if __name__ == "__main__":
    check_odbc_drivers()